<?php

namespace Admin\Controller;

use Utuo\BackgroundController;

class UploadController extends BackgroundController {
	// 上传一个文件
	public function uploadOneAction() {
		$this->upload(1);
	}
	
	public function uploadAction() {
		$this->upload();
	}
	
	private function upload($single = 0) {
		$fun = $single?"uploadOne":"uploadSome";
		$upload = new \Utuo\Upload();
		$info = $upload->$fun();
		if (!$info) {
			$this->ajaxError($upload->getError());
		} else {
			$this->ajaxSuccess("上传成功", $info);
		}
	}
	
		
}